/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package lexico;

import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author Pedrom
 */
public class Operators {

    private Map<String, String> single = new HashMap<>();//Os operadores que só aparecem sozinhos
    private Map<String, String> duple = new HashMap<>(); // os operadores que só aparecem em duplas
    private Map<String, String> other = new HashMap<>(); // Os operadores que podem aparecem sozinhos ou duplas.

    public Operators() {
        single.put("*", "*");
        single.put("/", "/");
        single.put(".", ".");
        single.put("<", "<");
        single.put(">", ">");
        duple.put("!", "!=");
        duple.put("&", "&&");
        duple.put("|", "||");
        other.put("+", "++");
        other.put("-", "--");
        other.put("=", "==");
        other.put(">", ">=");
        other.put("<", "<=");
    }

    public boolean isSingle(String key) {
        return single.containsKey(key);
    }

    public boolean isDuple(String key) {
        return duple.containsKey(key);
    }

    public boolean isOther(String key) {
        return other.containsKey(key);
    }
       public boolean canBeOperator(String key){
        if(single.containsKey(key) || duple.containsKey(key) || other.containsKey(key))
            return true;
        else
            return false;
    }
       public boolean containsDupleValue(String value){
           if(duple.containsValue(value)){
               return true;
           } else {
               return false;
           }
       }
       public boolean containsValue(String value){
           if(duple.containsValue(value) || single.containsValue(value) || other.containsValue(value)){
               return true;
           } else {
               return false;
           }
       }
    
}
